import objectable from "@/utils/objectable.js";
export default {
    data() {
        return {
            key: 1,
            deleteDialogs: { show: false, deleteText: '', deleteId: 0 },
            colData: [], //动态控制table
            tableData: [],//表格list
            total: 0, //总数量
            searchTable: ""
        }
    },
    created() {
        this.colData = objectable(this.checkboxVal, this.checkboxVal); //转为数组对象，好控制table
    },
    methods: {
        //删除弹窗Show
        deleteShow(id) {
            this.deleteDialogs.show = true
            this.deleteDialogs.deleteId = id
        },
        //搜索事件
        idnameSearch() {
            if (!this.select) return this.$message.warning("请先选择查询条件");
            this.listQuery = Object.assign({}, this.$options.data().listQuery, { [this.select]: this.searchTable || undefined })
            this.getTabularData();
        },
        //分页
        handleSizeChange(val) {
            this.listQuery.pageSize = val
            this.getTabularData()
        },
        handleCurrentChange(val) {
            this.listQuery.startSize = val
            this.getTabularData()
        },
        //刷新
        Refresh() {
            this.listQuery = this.$options.data().listQuery
            this.getTabularData()
        },
        //下拉动态table子组件
        alterCheckbok(key, conte) {
            this.key = key
            this.colData.filter(i => {
                if (conte.indexOf(i.title) != -1) {
                    i.istrue = false
                    this.$nextTick(() => {
                        this.$refs.tableDataRef.doLayout()
                    });
                } else {
                    i.istrue = true
                    this.$nextTick(() => {
                        this.$refs.tableDataRef.doLayout()
                    })
                }
            })
        }
    }
}